package com.swh.recruit.exception;

import com.swh.base.entity.Result;
import com.swh.base.entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: swh
 * @Description:
 * @Date: 2021/1/11 16:07
 * @Version: 1.0
 */
@ControllerAdvice
public class BaseExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result error(Exception e){
        return new Result(StatusCode.ERROR,e.getMessage());
    }

}
